Add commodity constraints input and validation - #1487
Conversation
|
@tsmbland I've taken a stab at this but some feedback would be helpful before I add tests |
tsmbland
left a comment
There was a problem hiding this comment.
Good start, but a few comments
- Cleaner parsing of region_id - Change units of limits from money to flow - Store time slice selection and balance type in `CommodityConstraint` struct - Store vectors of `CommodityConstraint`s in `CommodityConstraintMap`
c872f0a to
273b323
Compare
273b323 to
328243d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1487 +/- ##
==========================================
+ Coverage 90.31% 90.35% +0.03%
==========================================
Files 60 61 +1
Lines 8663 8850 +187
Branches 8663 8850 +187
==========================================
+ Hits 7824 7996 +172
- Misses 525 529 +4
- Partials 314 325 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
be131f2 to
03f77ef
Compare
tsmbland
left a comment
There was a problem hiding this comment.
Looks very good on the whole, just a few suggestions
tsmbland
left a comment
There was a problem hiding this comment.
Looks good!
Still a small error in the tests. As I don't think it affects the validity of the tests I'll approve, but probably worth fixing up for the sake of correctness!
Description
This PR adds a new module for reading and validating an input csv file for commodity constraints.
Commodity constraints are stored in a new
CommodityConstraintstruct, and the set of constraints provided are read and stored in aCommodityConstraintsMaptype, which mapsCommodityConstraints by region ID and year.CommodityConstraints have a single field,limits, which stores the range of values to which the commodity is constrained.An example commodity_constraints.csv file has been added to the "simple" setup for demonstration, and a corresponding schema has been added.
Fixes #1448
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks